<?php
/**
 * @describe
 *
 * @author wlx
 * @since 2018/11/5
 */

namespace App\Http\Controllers;


use App\Services\GeneralTool;
use App\Validates\TestValidate;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Str;

class TestController extends BaseController
{
    /**
     * 测试控制器
     * @return array
     */
    public function test(Request $request)
    {
        try {
            $uuid = GeneralTool::getOrderUuid();

            $validate = new TestValidate($request->all());
            if($validate->getErrors()){
                $this->setStatusCode(500001);
                return $this->createValidateResult($validate->getErrors());
            }
            return $this->createResult(
                ['uuid' => $uuid]
            );
        } catch (\Exception $e) {
            $this->addErrorLog($e, '测试错误');
            $this->setStatusCode(500);
            return $this->createResult();
        }
    }

}